﻿ #region Disclaimer/Info
 
 /////////////////////////////////////////////////////////////////////////////////////////////////
 //
 //   File:		PingBackAttribute.cs
 //   Website:		http://dexterblogengine.com/
 //   Authors:		http://dexterblogengine.com/About.ashx
 //   Rev:		1
 //   Created:		19/01/2011
 //   Last edit:		19/01/2011
 //   License:		GNU Library General Public License (LGPL)
 // 
 //   For updated news and information please visit http://dexterblogengine.com/
 //   Dexter is hosted to Codeplex at http://dexterblogengine.codeplex.com
 //   For any question contact info@dexterblogengine.com
 //
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
 #endregion

using System.Web.Mvc;
using Dexter.Dependency;
using Dexter.Services;

namespace Dexter.Web.Mvc.Filters {
	public class PingBackAttribute : ActionFilterAttribute {
		public IUrlBuilderBase UrlBuilderBase {
			get { return DexterContainer.Resolve <IUrlBuilderBase> ( ); }
		}

		/// <summary>
		/// 	Called by the MVC framework before the action method executes.
		/// </summary>
		/// <param name = "filterContext">The filter context.</param>
		public override void OnActionExecuting ( ActionExecutingContext filterContext ) {
			base.OnActionExecuting ( filterContext );

			filterContext.HttpContext.Response.AppendHeader ( "x-pingback" , UrlBuilderBase.PingBackUrl );
		}
	}
}
